package com.zc.angelica.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zc.angelica.entity.ResponseData;
import com.zc.angelica.mapper.PlatformInfoMapper;
import com.zc.angelica.entity.PlatformInfo;
import com.zc.angelica.service.PlatformInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 平台信息表(PlatformInfo)表服务实现类
 *
 * @author makejava
 * @since 2022-04-10 18:34:59
 */
@Service
public class PlatformInfoServiceImpl extends ServiceImpl<PlatformInfoMapper, PlatformInfo> implements PlatformInfoService {

    @Override
    public ResponseData addPlatformInfo(PlatformInfo platform) {
        boolean save = this.save(platform);
        if (save) {
            return ResponseData.success("添加成功");
        }
        return ResponseData.error("添加失败");
    }

    @Override
    public ResponseData selectPlatformInfo() {
        return ResponseData.success(this.list());
    }

    @Override
    public ResponseData updatePlatformInfo(PlatformInfo platform) {
        boolean update = this.updateById(platform);
        if (update) {
            return ResponseData.success("更新成功");
        }
        return ResponseData.error("更新失败");
    }

    @Override
    public ResponseData delPlatformInfo(Long id) {
        boolean remove = this.removeById(id);
        if (remove) {
            return ResponseData.success("删除成功");
        }
        return ResponseData.error("删除失败");
    }
}

